<?php

Raise::load('core.asset.RaiseAssetContainer');
Raise::load('core.collection.RaiseTypedCollection');

/**
 * RaiseAssetManager class
 * The manager for asset containers
 *
 * @author Sam Yong
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core.asset
 * @since 1.2
 */
class RaiseAssetManager extends RaiseAssetContainer {
    
    /**
     * A collection of custom label containers
     * @var RaiseTypedCollection
     */
    private $containers;
    
    /**
     * Create a new RaiseAssetManager
     */
    public function __construct(){
        parent::__construct();
        $this->containers = new RaiseTypedCollection('RaiseAssetContainer');
    }
    
    /**
     * Get a particular custom labelled container
     * @param string $name The container identifier
     * @return RaiseAssetContainer
     */
    public function container($name){
        if(!$this->containers->keyExists($name)){
            $this->containers->add($name, new RaiseAssetContainer());
        }
        return $this->containers->get($name);
    }
    
}